doctype
html
    head
        title Backbone Route Test
        meta(http-equiv="Content-Type", content="text/html; charset=UTF-8")
        script(src="../../lib/jquery.min.js")
        script(src = "../../lib/underscore.js")
        script(src = "../../lib/backbone.js")
    body
        script(type='text/javascript').
            var test = function(a){
                return alert("test:"+a)
            }
            var AppRoute = Backbone.Router.extend({
                routes:{
                    "post/:id": "getPost",
                    "test": test(1),
                    "": test(2),
                    "download/*path": "downloadFile"
                }
            });
            var appRoute = new AppRoute;
            appRoute.on('route:getPost', function (id) {
                alert("id:" + id);
            });
            appRoute.on("route:downloadFile",function(action){
                alert("downloadFile:" + action)
            });

            appRoute.navigate("test",{trigger: true});
            Backbone.history.start();

        a(type="button", href="#post/123") change hash